﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using GuiLibrary.layouts;

namespace GuiLibrary.Components
{
    public abstract class Component
    {
        public Component parent { get; set; }
        private Vector2 _relativePosition;
        public Vector2 relativePosition
        {
            get { return _relativePosition; }
            set { _relativePosition = value; }
        }
        public Vector2 getPosition()
        {
            if (parent == null)
                return relativePosition;
            else
                return parent.getPosition() + relativePosition;
        }


        public Component(Component parent, Vector2 relPosition) 
        {
            this.parent = parent;
            this.relativePosition = relPosition;
        }
        public Component() :
            this(null, new Vector2())
        { }

        

        public abstract void draw(SpriteBatch sb);
        public virtual void update(int dTime) { }
        public virtual void refresh() { }
        public virtual void moveCursor(Layout.Cursor cursor) { }
        public abstract Vector2 getSize();
    }
}
